﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;

namespace PrimaryAlgorithm.ShuffleArray
{
    /// <summary>
    /// 打乱数组
    /// </summary>
    class MainProject
    {
        static void Main(string[] args)
        {
            int[] nums = new int[] { 1, 3, 1, 3, 100 };
            //Console.WriteLine(Rob(nums));
            Console.ReadKey();
        }
    }
    public class Solution
    {
        private int[] m_Array;
        private List<int> m_List;
        public Solution(int[] nums)
        {
            m_Array = nums;
        }

        public int[] Reset()
        {
            return m_Array;
        }

        public int[] Shuffle()
        {
            List<int> list = m_Array.ToList();
            Random random = new Random();
            List<int> returnList = new List<int>();
            while (list.Count>0)
            {
                int index = random.Next(0, list.Count - 1);
                returnList.Add(list[index]);
                list.RemoveAt(index);
            }
            return returnList.ToArray();
        }
    }
}
